package
{
	import com.camic.server.tool.GetIPCityName;
	import com.camic.server.tool.GetIpCityWeather;
	
	import flash.display.Sprite;
	
	public class Main extends Sprite
	{
		public function Main()
		{
			GetIPCityName.getInstance()._get(onSuccessHandler,onFailHandler);
		}
		
		/**
		 * 获取城市名成功后就去获取天气状况 
		 * @param evt
		 */		
		private function onSuccessHandler(__cityName:String):void{
			GetIpCityWeather.getInstance()._get(__cityName, onWeatherSuccessHandler, onWeatherFailHandler);
		}
		
		private function onFailHandler():void{
			trace("获取城市名称失败");
			onLoadResHandler(false);
		}
		
		private function onWeatherSuccessHandler():void {
			trace("Main.onWeatherSuccessHandler(evt)，获取城市天气成功了 -----");
			//------------------------------
			onLoadResHandler(true);
		}
		
		/**
		 * 获取城市天气失败的处理方法 
		 */		
		private function onWeatherFailHandler():void {
			trace("获取城市天气失败");
			onLoadResHandler(false);
		}

		// ---------------------
		/**
		 * 加载资源界面 
		 */
		private function onLoadResHandler(_hasWeatherInfo:Boolean):void {
			// 为真则可以显示天气信息，为假则显示无法获取到天气信息
			if (_hasWeatherInfo) {
				
			} else {
				
			}
			
		}
	}
}